<template>
  <view><web-view :src="url"></web-view></view>
</template>

<script setup>
  import { onLoad } from '@dcloudio/uni-app';
  import { ref } from 'vue';

  const url = ref('');
  const params=ref('')
  onLoad((options) => {
	  // console.log(options);
	params.value= 
{
    "head": {
        "version": "1.0",
        "method": "sandpay.trade.orderCreate",
        "productId": "00002000",
        "accessType": "1",
        "mid": "100211701160001",
        "plMid": "",
        "channelType": "07",
        "reqTime": "20191017160750"
    },
    "body": {
        "orderCode": "GWPAY20191017160750",
        "userId": "",
        "totalAmount": "000000000002",
        "subject": "测试0.02元标题",
        "body": "{\"mallOrderCode\": \"mall00000000001\",\"receiveAddress\": \"上海市徐汇区XX路X楼X号202\",\"goodsDesc\": \"测试商品\"}",
        "txnTimeOut": "",
        "payModeList": "[b2b,b2c,qrpay,qppay,rempay,sdb]",
        "notifyUrl": "https://xxx.xx.xxx/notifyUrl/xxx.xxx",
        "frontUrl": "https://xxx.xx.xxx/notifyUrl/xxx.xxx",
        "storeId": "",
        "terminalId": "",
        "operatorId": "",
        "clearCycle": "",
        "accountingMode": "",
        "riskRateInfo": "",
        "bizExtendParams": "",
        "merchExtendParams": "",
        "extend": "",
        "accsplitInfo":{"accsplitMode":"3"} 
        
    }
}
 uni.request({
   url: 'https://cashier1.sandpay.com.cn/gw/web/order/create',
   method: 'POST',
   header: {
     'Content-Type': 'application/x-www-form-urlencoded'
  },
   data: params,
   success: function (res) {
     // 支付接口请求成功的回调处理
 	console.log('1');
 	console.log(res);
 	url.value=res
 	
     // 在这里可以进行支付成功后的跳转逻辑
   },
   fail: function (err) {
 	  console.log('2');
     // 支付接口请求失败的回调处理
   }
 });
 
	   // url.value ="https://cashier1.sandpay.com.cn/gw/web/order/create?params="+params;
	  // console.log(JSON.parse(decodeURIComponent(options.url)));
      // console.log(JSON.parse(decodeURIComponent(options.url)));
    // url.value = decodeURIComponent(options.url);
    // url.value =JSON.parse(decodeURIComponent(options.url))
    // url.value =    "https://cashier1.sandpay.com.cn/gw/web/order/toIndex?p=UHWOtxlSettzLiVZ6oJFbbiaZw3aLhc%2Bjv65QCAE0iEGQY2AyP%2FYW2G4ovXCRRBxSpG%2FjTxbpcj%2FsZ3YBlXuSJTurldwluAevXvlmdzJAJ%2BfyHVkdsar7i372InkdqwYUxD37RLgJnZTNEdICtcj%2Ft%2Fk9CbzIJctb%2FExgtyDj%2F0c2KEJei%2BAB9qgAYsokWhaysuqGSyFh9o%3D"
	 // url.value ="https://cashier1.sandpay.com.cn/gw/web/order/toIndex?p=UHWOtxlSetsXeRhrn5F22GTYoOu2Np6cAVxp6icACUFKl%2B5mGKlX%2BtNx9RI9t7aNSsYFvIpLpEHVf1Wt0NIFOrsA%2FOP1xPinoyMi5XRpBnB4rCyigVFB3mZlOACYrQFwSZEn2ZKHzEXOLjcv721UGSGgG57KvWk0HxNw%2BXL%2FYzRUemQmkKU%2F6td81q6WE1GF3BX%2FTFvmhV4%3D#"
  });
</script>/

<style lang="scss" scoped></style>
